package org.lgiavedoni.android.franq.core.communication;

import lombok.Data;
import lombok.EqualsAndHashCode;

import org.lgiavedoni.android.franq.core.message.MessageIn;

@Data
@EqualsAndHashCode
public class ChannelKey {

	private final String user;

	private final CommunicationSource source;

	private ChannelKey(String user, CommunicationSource source) {
		super();
		this.user = user;
		this.source = source;
	}

	public static ChannelKey generateKey(String user, CommunicationSource source) {
		return new ChannelKey(user, source);
	}

	public static ChannelKey generateKey(MessageIn message) {
		return new ChannelKey(message.getUser(), message.getSource());
	}
}
